<template>
  <div class="container">
    <el-col :span="24" style="margin-top: 30px;text-align: left">
      <!--      <el-col :span="24" style="margin-top: 30px;margin-bottom: 30px">
              <h3 style="font-size: 2.0vw">居民信息填写</h3>
            </el-col>-->
      <el-col :span="24">
        <el-form ref="form"  label-width="130px" style="margin-top: 30px">

          <el-col :span="4" v-for="(item,index ) in cols" :key="index" style="float: left">
            <el-form-item :label="item.province" style="float: left">
              <el-input v-model="item.quantity"></el-input>
            </el-form-item>
          </el-col>

          <el-col :span="24" style="float: left">
            <el-form-item style="float: left">
              <el-button type="primary" @click="onSubmit">提交</el-button>
              <el-button>取消</el-button>
            </el-form-item>
          </el-col>
        </el-form>
      </el-col>
    </el-col>
  </div>
</template>

<script>
  export default {
    name: "indexAdd",
    data() {
      return {
        cols: [
          {
            province: '南沙群岛',
            quantity: 0
          },
          {
            province: '北京市',
            quantity: 0
          },
          {
            province: '天津市',
            quantity: 0
          },
          {
            province: '上海市',
            quantity: 0
          },
          {
            province: '重庆市',
            quantity: 0
          },
          {
            province: '河北省',
            quantity: 0
          },
          {
            province: '河南省',
            quantity: 0
          },
          {
            province: '云南省',
            quantity: 0
          },
          {
            province: '辽宁省',
            quantity: 0
          },
          {
            province: '黑龙江省',
            quantity: 0
          },
          {
            province: '湖南省',
            quantity: 0
          },
          {
            province: '安徽省',
            quantity: 0
          },
          {
            province: '山东省',
            quantity: 0
          },
          {
            province: '新疆维吾尔自治区',
            quantity: 0
          },
          {
            province: '江苏省',
            quantity: 0
          },
          {
            province: '浙江省',
            quantity: 0
          },
          {
            province: '江西省',
            quantity: 0
          },
          {
            province: '湖北省',
            quantity: 0
          },
          {
            province: '广西壮族自治区',
            quantity: 0
          },
          {
            province: '甘肃省',
            quantity: 0
          },
          {
            province: '山西省',
            quantity: 0
          },
          {
            province: '内蒙古自治区',
            quantity: 0
          },
          {
            province: '陕西省',
            quantity: 0
          },
          {
            province: '吉林省',
            quantity: 0
          },
          {
            province: '福建省',
            quantity: 0
          },
          {
            province: '贵州省',
            quantity: 0
          },
          {
            province: '广东省',
            quantity: 0
          },
          {
            province: '青海省',
            quantity: 0
          },
          {
            province: '西藏自治区',
            quantity: 0
          },
          {
            province: '四川省',
            quantity: 0
          },
          {
            province: '宁夏回族自治区',
            quantity: 0
          },
          {
            province: '海南省',
            quantity: 0
          },
          {
            province: '台湾省',
            quantity: 0
          },
          {
            province: '香港特别行政区',
            quantity: 0
          },
          {
            province: '澳门特别行政区',
            quantity: 0
          }],
        requestData: {
          current: 1,
          pageSize: 10,
          requestData: {
          }
        },
      }
    },
    created() {

    },
    mounted() {
      this.initData()
    },
    methods: {
      initData(){
        this.service.post('/tbepidemic/list'
          , this.requestData)
          .then(result => {
            let data = result.data.data.data
            console.log(data)
            this.cols = data;
          })
      },
      onSubmit(){
        this.service.post('/tbepidemic/updateArray'
          , {data:this.cols})
          .then(result => {
              this.$message.success("修改成功！")
          })
      }
    }
  }
</script>

<style scoped>

</style>
